package com.app.view.loading 
{
	import flash.display.MovieClip;
	import com.peachcastle.core.Display;
	
	import com.peachcastle.debug.Log;
	
	public class RoomLoading extends Display
	{
		
		private var _txtAnimation:MovieClip = null;
		private var _animationView:MovieClip = null;
		private var _loadingMC:MovieClip = null;
		
		public function RoomLoading(ui:MovieClip = null) 
		{
			super(ui,true);
		}
		
		override protected function initialization():void 
		{
			super.initialization();
			
			_txtAnimation = assest["txtAnimation"];
			_animationView = assest["animationView"];
			_loadingMC = assest["loadingMC"];
			_txtAnimation.stop();
			_animationView.stop();
			_loadingMC.stop();
		}
		
		private var _load:Boolean = false;
		
		public function showPercent(percent:Number = 0):void
		{
			
			Log.debug("showPercent", _load, assest.visible, _txtAnimation.visible, _animationView.visible);
			
			super.showAssest();
			if (_load)
			{
				_loadingMC.gotoAndStop(percent);
				return;
			}
			
			_load = true;
			_txtAnimation.play();
			_animationView.play();
		}
		
		public function hide():void
		{
			super.hideAssest();
			
			_txtAnimation.stop();
			_animationView.stop();
		}
		
	}

}